package singleton;

public class Principal {
    private static Principal instance;

    private String name;

    //构造函数设计为私有 防止实例化多个对象
    private Principal() {
        this.name = "邓校长";
    }

    //获取校长实例的公共方法，采用单例设计模式
    public static Principal getInstance() {
        if( instance == null) {
            instance = new Principal();
        }

        return instance;
    }

    //校长的一些行为
    public void announcement(String message) {
        System.out.println(name + "通知：" + message);
    }

    public void approveDocument(String file) {
        System.out.println(name + "审批通过" + file);
    }
}
